class Solution(object):
    def getXORSum(self, arr1, arr2):
        d1 = {i: 0 for i in range(32)}
        d2 = {i: 0 for i in range(32)}
        for num in arr1:
            for i in range(32):
                if (num >> i) & 1:
                    d1[i] += 1
        for num in arr2:
            for i in range(32):
                if (num >> i) & 1:
                    d2[i] += 1
        ans = 0
        for i in range(32):
            if d1[i] * d2[i] % 2:
                ans |= (1 << i)
        return ans

data = Solution()
arr1 = [1, 2, 3]
arr2 = [6, 5]
print(data.getXORSum(arr1, arr2))
